{extend name="layout/layout" /}

{block name="pagecss"}
<style>
    table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable td:last-child, table.table-bordered.dataTable td:last-child {
        border-right-width: 1px;
    }
</style>
{/block}

{block name="content"}
<div class="row js-check-wrap">
    <div class="col-lg-12">
        <div class="portlet light">
            <div class="box-header">
                <div class="row">
                    <div class="col-md-9">
                        <form id="searchForm" action="" class="form" method="post">
                            <input class="city" type="hidden" name="cityId" value="{$povertypolicyledger.cityId}">
                            <input class="xian" type="hidden" name="xianId" value="{$povertypolicyledger.xianId}">
                            <input class="town" type="hidden" name="townId" value="{$povertypolicyledger.townId}">
                            <input class="village" type="hidden" name="villageId" value="{$povertypolicyledger.villageId}">
                            <p class="form-control-static"> {$area} </p>
                        </form>
                    </div>
                    <div class="col-md-3">
                        <div class="pull-right">
                            <button type="button" class="btn dark btn-circle" data-toggle="modal" data-target="#handle_modal">
                                <i class="fa fa-random"></i> 批量操作
                            </button>
                            <a href="{:url('admin/'.strtolower($model).'/add', ['ledgerId' => $ledgerId])}" class="btn blue btn-circle"><i class="fa fa-plus"></i> 新增</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="portlet-body">
                <form class="js-ajax-form" method="post">
                    <div class="">
                        <table id="data-table" class="table table-bordered table-hover dataTable">
                            <thead>
                                {$customHeader}
                            </thead>
                        </table>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- 操作弹框 -->
<div class="modal fade" id="handle_modal" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="width:700px; height: 520px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">x</button>
                <h4 class="modal-title">批量操作</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="control-label col-md-4">
                                批量导入模板：
                            </label>
                            <div class="col-md-8">
                                <button type="button" id="download_template" class="btn blue" data-url="{:url('admin/povertypolicy/downloadTemplate', ['ledgerId' => $ledgerId])}"> 下载Excel模板 </button>
                                <span>请按照模板编辑数据</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row" style="margin: 10px 0">
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="control-label col-md-4" style="padding: 0">
                                批量导入：
                            </label>
                            <div class="col-md-8">
                                <form id="import_form" action="{:url('admin/povertypolicy/import', ['ledgerId' => $ledgerId])}" method="post" enctype="multipart/form-data">
                                    <input type="hidden" class="form-control" name="_token" value="">
                                    <button type="button" id="import_csv" class="btn blue" style="float: left;margin-right: 10px;margin-left: -5px"> 导入 </button>
                                    <input type="file" class="form-control" id="csv_file" name="csv_file" style="float: left;width: 60%">
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="control-label col-md-4">
                                批量导出：
                            </label>
                            <div class="col-md-8">
                                <input type="hidden" class="form-control" name="ledgerId" value="{$ledgerId}">
                                <button type="button" id="export_csv" data-url="{:url('admin/povertypolicy/export', ['ledgerId' => $ledgerId])}" class="btn blue">
                                    <i class="fa fa-download"></i> 导出数据
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--<div class="modal-footer">
                <button type="button" class="btn default" data-dismiss="modal"> 关闭 </button>
            </div>-->
        </div>
    </div>
</div>

<input type="hidden" class="datalist_url" value="{:url('admin/'.strtolower($model).'/index', ['ledgerId' => $ledgerId])}">
<input type="hidden" class="edit_url" value="{:url('admin/'.strtolower($model).'/edit', ['ledgerId' => $ledgerId])}">
<input type="hidden" class="delete_url" value="{:url('admin/'.strtolower($model).'/delete')}">
{/block}

{block name="pagescript"}
<script>
    var COLUMNS = {$tableColumns};
</script>
<script src="__STATIC__/admin/pages/js/povertypolicy.js" type="text/javascript"></script>
{/block}